package com.zdb.n1.payload.response;

import com.zdb.n1.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserResponse {
    
    private Long id;
    private String username;
    private String fullName;
    private String email;
    private String phone;
    private User.Gender gender;
    private LocalDateTime birthDate;
    private LocalDateTime registrationDate;
    private User.Role role;
    private boolean enabled;
    
    public static UserResponse fromEntity(User user) {
        UserResponse response = new UserResponse();
        response.setId(user.getId());
        response.setUsername(user.getUsername());
        response.setFullName(user.getFullName());
        response.setEmail(user.getEmail());
        response.setPhone(user.getPhone());
        response.setGender(user.getGender());
        response.setBirthDate(user.getBirthDate());
        response.setRegistrationDate(user.getRegistrationDate());
        response.setRole(user.getRole());
        response.setEnabled(user.isEnabled());
        return response;
    }
} 